/**
 * Names
 * 
 * 26/10/2013
 * 
 * Copyright GPL
 */
package com.jtmproject.struts.tulebox;

import com.jtmproject.struts.tulebox.classes.GenerateNames;
import com.opensymphony.xwork2.ActionSupport;

/**
 * This class is an action to return the names generated
 * @author Javier Tejedor
 */
public class Names extends ActionSupport {
	
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -3710554965547687024L;
	
	private int nameSelected;
	private String namesGenerated;
	private String generateName;
	private int numberOfNames;

	/**
	 * this is the default method to execute
	 */
	@Override
    public String execute() {
    	namesGenerated = new GenerateNames().generateNames(nameSelected, numberOfNames);
        return SUCCESS;
    }

	/**
	 * this returns the name selected
	 * @return
	 */
	public int getNameSelected() {
		return nameSelected;
	}

	/**
	 * this sets the name selected
	 * @param nameSelected
	 */
	public void setNameSelected(int nameSelected) {
		this.nameSelected = nameSelected;
	}

	/**
	 * this returns the names generated
	 * @return
	 */
	public String getNamesGenerated() {
		return namesGenerated;
	}

	/**
	 * this sets the names generated
	 * @param namesGenerated
	 */
	public void setNamesGenerated(String namesGenerated) {
		this.namesGenerated = namesGenerated;
	}

	/**
	 * this gets the number of the names
	 * @return
	 */
	public int getNumberOfNames() {
		return numberOfNames;
	}

	/**
	 * this sets the number of the names
	 * @param numberOfNames
	 */
	public void setNumberOfNames(int numberOfNames) {
		this.numberOfNames = numberOfNames;
	}

	/**
	 * this is for adding the text into the button submit
	 * @return
	 */
	public String getGenerateName() {
		return generateName;
	}

	/**
	 * this is for adding the text into the button submit
	 * @param generateName
	 */
	public void setGenerateName(String generateName) {
		this.generateName = generateName;
	}

	/**
	 * this method is called the first time that the user call Dice.jsp
	 */
    @Override
    public String input() throws Exception{
    	return super.input();
    }
}

